package priv.winnine.config;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
import priv.winnine.interceptor.AuthInterceptor;
import priv.winnine.service.AuthService;

@Configuration
public class WebAppConfig implements WebMvcConfigurer {

    @Autowired
    private AuthService authService;

    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        // 可添加多个，这里选择拦截所有请求地址
        registry.addInterceptor(new AuthInterceptor(authService)).addPathPatterns("/**");
    }

}
